package game.event;

import game.Game;

public class EventLogReplay implements Runnable{
	
	private boolean play = false;
	private int logIndex = 0;
	private EventLog log;
	private Game game;

	public EventLogReplay(EventLog log, Game game){
		this.log = log;
		this.game = game;
		log.normalizeLog();
	}
	
	public void play(){
		log.getEvent(logIndex).perform(game);
		logIndex++;
	}

	@Override
	public void run() {
		while(log.getNumEntries() > logIndex)
			if(play)
				play();
	}
}